<?php

namespace app\admin\controller\auth;

use think\Request;

use app\admin\service\auth\RoleService;
use app\admin\controller\Base;

class Role extends Base
{
    public function list(Request $request)
    {
        $param = $request->param();
        $service = new RoleService();
        return $service->getList($param);
    }
    public function edit(Request $request)
    {
        $data = $request->param();
        $service = new RoleService();
        $id = $data['id'];
        unset($data['id']);
        return $service->Edit($id, $data);
    }
    public function add(Request $request)
    {
        $data = $request->param();
        $service = new RoleService();
        return $service->Add($data);
    }
    public function del(Request $request)
    {
        $data = $request->param();
        $ids = is_array($data['ids']) ? $data['ids'] : explode(',', $data['ids']);
        $service = new RoleService();
        return $service->Delete($ids);
    }
}
